import {fileURLToPath, URL} from 'node:url'
import {defineConfig, loadEnv} from 'vite'
import vue from '@vitejs/plugin-vue'

const srcPath = fileURLToPath(new URL("src", import.meta.url))
const envPrefix = 'APP_'

// https://vitejs.dev/config/
export default defineConfig(({command, mode, ssrBuild}) => {
    const env = loadEnv(mode, process.cwd(), envPrefix)
    return {
        envPrefix: envPrefix,
        base: env.APP_BASE_URL || './',
        resolve: {
            alias: {
                '@': srcPath
            }
        },
        plugins: [
            vue(),
        ],
    }
})
